//#pragma once //防止头文件重复被包含
#ifndef __MYSTDIO_H__
#define __MYSTDIO_H__

#include<string.h>

#define SIZE 1024 //缓冲区

//真正库会对文件类型做识别
//这简化写个大概
#define FLUSH_NOW 1
#define FLUSH_LINE 2
#define FLUSH_ALL 4

typedef struct IO_FILE{
    int fileno;//文件描述符fd
    
    //缓冲区
    //char inbuffer[SIZE];//输入
    //int in_pos;
    char outbuffer[SIZE];
    int out_pos;//缓冲区写到哪里

    int flag;

}_FILE;

_FILE* _fopen(const char* filename,const char *flag);
int _fwrite(_FILE *fp,const char* s,int len);
void _fclose(_FILE *fp);
void _fflush(_FILE* fp);

#endif
